//
//  BaseViewController.h
//  Nidalee
//
//  Created by 李康 on 2020/11/30.
//  Copyright © 2020 李康. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "BaseMacroConfig.h"
#import <Masonry/Masonry.h>

NS_ASSUME_NONNULL_BEGIN

typedef void (^RefreshBlock)(id data);

@interface BaseViewController : UIViewController
//用于通知上级viewcontroller刷新
@property(nonatomic, copy)RefreshBlock callBack;

@property(nonatomic, strong) UIButton *rightBtn;
@property(nonatomic, strong) UIScrollView *scrollView;


-(void)initNavigationBar;
/**设置标题*/
-(void)setNavTitle:(NSString *)title;

/**设置是否显示左BarButton*/
-(void)addLeftImgBarButtonByItemImg:(NSString *)imgName;
-(void)addLeftTextBarButtonByItemTitle:(NSString *)title;

/**设置是否显示右BarButton*/
-(void)addRightImgBarButtonByItemImg:(NSString *)imgName;
-(void)addRightTextBarButtonByItemTitle:(NSString *)title;

/**左BarButton自定义事件*/
-(void)leftBarAction:(id)sender;

/**右BarButton自定义事件*/
-(void)rightBarAction:(id)sender;
/**返回上一级页面*/
-(void)popViewController;

/**返回指定页面(传入VC名=>@"ELBaseViewController")*/
-(BOOL)popToViewController:(NSString *)vcName;

/**返回根页面*/
-(void)popToRootViewController;
/*下拉刷新加载更多相关*/
-(void)addPullRefreshToView:(UIScrollView *)view;
-(void)addLoadMoreToView:(UIScrollView *)view;
//操作开始或者停止
-(void)beginRefresh;
-(void)endRefresh;
-(void)endLoadMore;
-(BOOL)isRefreshing;
//子类实现下拉刷新数据
-(void)refreshData;
//子类实现加载更多数据
-(void)loadMoreData;

-(void)addCenterView:(UIView *)view;

-(void)initData;
@end

NS_ASSUME_NONNULL_END
